package Activity.Demo;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;


public class FirstActivity extends Activity {
    
	EditText editText = null;
	Button btnStartSecondActivity = null;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        editText = (EditText)this.findViewById(R.id.editText);
        btnStartSecondActivity = (Button)this.findViewById(R.id.btnStartSecondActivity);
        
        //find out button
        btnStartSecondActivity.setOnClickListener(new View.OnClickListener() {	
            
    		public void onClick(View v) {
    			final String currentText = editText.getText().toString();
    			Intent intent = new Intent(FirstActivity.this, SecondActivity.class);
    			intent.putExtra("parameter1", currentText);
    			FirstActivity.this.startActivity(intent);
    		}
    	});
        //set listener for button
       
        Log.v("CycleLife", "MainActivity -> onCreate()");
    }

	@Override
	protected void onSaveInstanceState(Bundle outState) {
		super.onSaveInstanceState(outState);
		
		Log.v("CycleLife", "MainActivity -> onSaveInstanceState()");
	}

	@Override
	protected void onRestoreInstanceState(Bundle savedInstanceState) {
		super.onRestoreInstanceState(savedInstanceState);
		Log.v("CycleLife", "MainActivity -> onRestoreInstanceState()");
	}

	@Override
	protected void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();
		Log.v("CycleLife", "MainActivity -> onDestroy()");
	}

	@Override
	protected void onPause() {
		// TODO Auto-generated method stub
		super.onPause();
		Log.v("CycleLife", "MainActivity -> onPause()");
	}

	@Override
	protected void onRestart() {
		// TODO Auto-generated method stub
		super.onRestart();
		Log.v("CycleLife", "MainActivity -> onRestart()");
	}

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		Log.v("CycleLife", "MainActivity -> onResume()");
	}

	@Override
	protected void onStart() {
		// TODO Auto-generated method stub
		super.onStart();
		Log.v("CycleLife", "MainActivity -> onStart()");
	}

	@Override
	protected void onStop() {
		// TODO Auto-generated method stub
		super.onStop();
		Log.v("CycleLife", "MainActivity -> onStop()");
	}
}